import 'package:flutter/material.dart';
import 'package:flutter_plugin/plugin/plugin_t1.dart';
import 'package:flutter_plugin/widget/appbar.dart';
import 'package:flutter_plugin/widget/login_button.dart';
import 'package:get/get.dart';

import 'plugin_logic.dart';

class PluginPage extends StatelessWidget {
  PluginPage({Key? key}) : super(key: key);
  final logic = Get.find<PluginLogic>();
  final state = Get.find<PluginLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: appBar('Flutter Android 插件', '', () {}),
      body: Column(
        children: [
          Obx(
            () => Text(logic.text.value),
          ),
          Padding(
            padding: const EdgeInsets.only(left: 20, right: 20, top: 20),
            child: LoginButton(
              'method1--跳转到android插件页面',
              onPressed: () async {
                var result = await PluginT1.method1();
                logic.text.value = result;
              },
            ),
          ),
        ],
      ),
    );
  }
}
